FROM konajdk:8.0.7_8u302-alpine
#FROM konajdk:8.0.11_8u345-alpine
#FROM konajdk:8.0.9_8u322-alpine

RUN \
    mkdir -p /opt/deploy

COPY *.jar /opt/deploy

ARG APP_VERSION=1.0.0
ARG APP_NAME="Spring Boot Project"
ARG APP_DESCRIPTION="Spring Boot Project"

ENV APP_VERSION=${APP_VERSION}
ENV APP_NAME=${APP_NAME}
ENV HTTP_AUTHORIZATION_BASE64_ENABLED=false
LABEL version=${APP_VERSION}
LABEL name=${APP_NAME}
LABEL description=${APP_DESCRIPTION}

RUN \
#    tar -xzvf /opt/deploy/*.tar.gz -C /opt/deploy && \
#    /bin/rm -rf /opt/deploy/*.tar.gz && \
#    mkdir -p /opt/deploy/logs  /opt/deploy/data && \
#    cp -vr /opt/deploy/*/* /opt/deploy && \
#    mkdir -p /opt/deploy/bin && \
#    chmod +x /opt/deploy/bin  && \
    mv /opt/deploy/*.jar /opt/deploy/sf-app.jar && \
    true

# config
#ADD config /opt/deploy/config

WORKDIR /opt/deploy
# Add a healthcheck (default every 30 secs)
#HEALTHCHECK CMD curl http://localhost:8080/docket/health || exit 1
#rmi config hostname --> rmi.m7it.com
#ENTRYPOINT ["java","-XX:+UseContainerSupport","-XX:+UseAsyncGCLog","-XX:MaxRAMPercentage=90.0","-jar","sf-app.jar"]
ENTRYPOINT ["java","-XX:+UseContainerSupport","-XX:MaxRAMPercentage=90.0","-agentlib:jdwp=transport=dt_socket,address=65530,server=y,suspend=n","-Dcom.sun.management.jmxremote.rmi.port=65532","-Dcom.sun.management.jmxremote.port=65532","-Dcom.sun.management.jmxremote.ssl=false","-Dcom.sun.management.jmxremote.authenticate=false","-Djava.rmi.server.hostname=rmi.m7it.com","-jar","sf-app.jar"]

